/**
 @file ctc_field.h

 @date 2015-12-19

 @version v1.1

 The file define api struct used in ACL/SCL/Ipfix.
*/

#ifndef _CTC_FIELD_H_
#define _CTC_FIELD_H_

#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************
 *
 * Header Files
 *
 ***************************************************************/


/****************************************************************
*
* Defines and Macros
*
****************************************************************/
#define CTC_UDF_WORD_NUM    4
typedef uint32 ctc_udf_t[CTC_UDF_WORD_NUM];

/** @brief  key field */
/* Short names
 * Direction    : I-ingress, E-egress, B-both direction
 * Module       : S-SCL, A-ACL, U-UDF, P-Presel, F-Flow hash, H-SCL hash, D-DOT1AE, I-IPFIX, T-ALL,
 * Example      : [IS.IA] means Ingress ACL or Ingress SCL used
 */
enum ctc_field_key_type_e
{
    /*Packet type field*/
    CTC_FIELD_KEY_L2_TYPE,                  /**< [D2.TM.TMM.TMA.AT][IS.BA.IU] Layer 2 type (ctc_parser_l2_type_t). */
    CTC_FIELD_KEY_L3_TYPE,                  /**< [D2.TM.TMM.TMA.AT][BT] Layer 3 type (ctc_parser_l3_type_t). */
    CTC_FIELD_KEY_L3_EXT_TYPE,              /**< [TMM.AT][IA.IU.IP] Layer 3 ext type (ctc_parser_l3_ext_type_t) */
    CTC_FIELD_KEY_L4_TYPE,                  /**< [D2.TM.TMM.TMA.AT][BT] Layer 4 type (ctc_parser_l4_type_t). */
    CTC_FIELD_KEY_L4_USER_TYPE,             /**< [D2.TM.TMM.AT][IS.BA.IP.IU] Layer 4 Usertype (ctc_parser_l4_usertype_t). */

    /*Ether  field*/
    CTC_FIELD_KEY_MAC_SA,                   /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IF.BI] Source MAC Address. */
    CTC_FIELD_KEY_MAC_DA,                   /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IF.BI] Destination MAC Address. */
    CTC_FIELD_KEY_STAG_VALID,               /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IF] S-Vlan Exist. */
    CTC_FIELD_KEY_PKT_STAG_VALID,           /**< [TM.TMM.AT][IS] Packet S-Vlan Exist. */
    CTC_FIELD_KEY_PKT_CTAG_VALID,           /**< [TM.TMM.AT][IS] Packet C-Vlan Exist. */
    CTC_FIELD_KEY_SVLAN_ID,                 /**< [D2.TM.TMM.TMA.AT][IS.BH.BA.IF.BI] S-Vlan ID. */
    CTC_FIELD_KEY_STAG_COS,                 /**< [D2.TM.TMM.TMA.AT][IS.BH.BA.IF.BI] Stag Cos. */
    CTC_FIELD_KEY_STAG_CFI,                 /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IF.BI] Stag Cfi. */
    CTC_FIELD_KEY_CTAG_VALID,               /**< [D2.TM.TMM.TMA.AT][IS.BA.IF] C-Vlan Exist. [TM.TMM] C-Vlan Exist(ParserResult Vlan or Vlan Range or Default Vlan) */
    CTC_FIELD_KEY_CVLAN_ID,                 /**< [D2.TM.TMM.TMA.AT][IS.BH.BA.IF.BI] C-Vlan ID. */
    CTC_FIELD_KEY_CTAG_COS,                 /**< [D2.TM.TMM.TMA.AT][IS.BH.BA.IF.BI] Ctag Cos. */
    CTC_FIELD_KEY_CTAG_CFI,                 /**< [D2.TM.TMM.TMA.AT][IS.BA.IF.BI] Ctag Cfi. */
    CTC_FIELD_KEY_SVLAN_RANGE,              /**< [D2.TM.TMM.TMA.AT][BA.IF.IS] Svlan Range; data: min, mask: max, ext_data: (uint32*)vrange_gid. */
    CTC_FIELD_KEY_CVLAN_RANGE,              /**< [D2.TM.TMM.TMA.AT][BA.IF.IS] Cvlan Range; data: min, mask: max, ext_data: (uint32*)vrange_gid. */
    CTC_FIELD_KEY_ETHER_TYPE,               /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IU.IF] Ether type. */
    CTC_FIELD_KEY_VLAN_NUM,                 /**< [D2.TM.TMM.AT][IS.BA.IU] Vlan Tag Number, Share with L2 Type. */
    CTC_FIELD_KEY_STP_STATE,                /**< [D2.TM.TMM.AT][IA] Stp Status. 0:forwarding, 1:blocking, 2:learning and 3: no forwarding (include learning or blocking)*/
    CTC_FIELD_KEY_MAPPED_STAG_VALID,        /**< [TMM.AT][IS.IA] Mapped svlan exist which be tranlated*/
    CTC_FIELD_KEY_MAPPED_SVLAN_ID,          /**< [TMM.AT][IS.IA] Mapped svlan id which be tranlated*/
    CTC_FIELD_KEY_MAPPED_SVLAN_CFI,         /**< [TMM.AT][IA] Mapped svlan cfi which be tranlated*/
    CTC_FIELD_KEY_MAPPED_SVLAN_COS,         /**< [TMM.AT][IA] Mapped svlan cos which be tranlated*/
    CTC_FIELD_KEY_MAPPED_CTAG_VALID,        /**< [TMM.AT][IS.IA] Mapped cvlan exist which be tranlated*/
    CTC_FIELD_KEY_MAPPED_CVLAN_ID,          /**< [TMM.AT][IS.IA] Mapped cvlan id which be tranlated*/
    CTC_FIELD_KEY_MAPPED_CVLAN_CFI,         /**< [TMM.AT][IA] Mapped cvlan cfi which be tranlated*/
    CTC_FIELD_KEY_MAPPED_CVLAN_COS,         /**< [TMM.AT][IA] Mapped cvlan cos which be tranlated*/

    /*IP packet field*/
    CTC_FIELD_KEY_IP_SA,                    /**< [D2.TM.TMM.TMA.AT][IS.BA.IH.IF.BD.BI] Source IPv4 Address. */
    CTC_FIELD_KEY_IP_DA,                    /**< [D2.TM.TMM.TMA.AT][IS.BA.IH.IF.BD.BI] Destination IPv4 Address. */
    CTC_FIELD_KEY_IPV6_SA,                  /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IF.BD.BI] Source IPv6 Address. ext_data */
    CTC_FIELD_KEY_IPV6_DA,                  /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IF.BD.BI] Destination IPv6 Address. ext_data */
    CTC_FIELD_KEY_IPV6_FLOW_LABEL,          /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Ipv6 Flow label*/
    CTC_FIELD_KEY_IP_PROTOCOL,              /**< [D2.TM.TMM.TMA.AT][BA.IU.IF.BD.BI] Ip Protocol. */
    CTC_FIELD_KEY_IP_DSCP,                  /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IF.BI] DSCP. */
    CTC_FIELD_KEY_IP_PRECEDENCE,            /**< [D2.TM.TMM.AT][BA.IF] Precedence. */
    CTC_FIELD_KEY_IP_ECN,                   /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Ecn. */
    CTC_FIELD_KEY_IP_FRAG,                  /**< [D2.TM.TMM.TMA.AT][IS.BA.IU.IF.BI] IP Fragment Information. */
    CTC_FIELD_KEY_IP_HDR_ERROR,             /**< [D2.TM.TMM.AT][IS.BA.IP.IF] Ip Header Error. */
    CTC_FIELD_KEY_IP_OPTIONS,               /**< [D2.TM.TMM.TMA.AT][IS.BA.IU.IP.IF] Ip Options. */
    CTC_FIELD_KEY_IP_PKT_LEN_RANGE,         /**< [D2.TM.TMM.TMA.AT][BA.BI] Ip Packet Length Range. */
    CTC_FIELD_KEY_IP_TTL,                   /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Ttl. */
    CTC_FIELD_KEY_IS_IP_PKT,                /**< [TM.TMM.AT][IS] Is IPv4 or IPv6 Packet */
    CTC_FIELD_KEY_IP_IDENTIFICATION,        /**< [AT][BI] Is IPv4 or IPv6 ip identification */
    CTC_FIELD_KEY_IP_PKT_LEN,               /**< [AT][BI] Ip Packet Length */

    /*ARP packet field*/
    CTC_FIELD_KEY_ARP_OP_CODE,                  /**< [D2.TM.TMM.AT][IS.BA.BI] Opcode Field of ARP Header. */
    CTC_FIELD_KEY_ARP_PROTOCOL_TYPE,            /**< [D2.TM.TMM.AT][IS.BA] Protocol Type of ARP Header. */
    CTC_FIELD_KEY_ARP_SENDER_IP,                /**< [D2.TM.TMM.AT][IS.IH.BA] Sender IPv4 Field of ARP Header. */
    CTC_FIELD_KEY_ARP_TARGET_IP,                /**< [D2.TM.TMM.AT][IS.BA] Target IPv4 Field of ARP Header */
    CTC_FIELD_KEY_ARP_MAC_DA_CHK_FAIL,          /**< [D2.TM.TMM.AT][BA] Destination MAC Address of ARP Header Check Fail */
    CTC_FIELD_KEY_ARP_MAC_SA_CHK_FAIL,          /**< [D2.TM.TMM.AT][BA] Source MAC Address of ARP Header Check Fail */
    CTC_FIELD_KEY_ARP_SENDERIP_CHK_FAIL,        /**< [D2.TM.TMM.AT][BA] IP Address of sender of ARP Header Check Fail */
    CTC_FIELD_KEY_ARP_TARGETIP_CHK_FAIL,        /**< [D2.TM.TMM.AT][BA] IP Address of destination of ARP Header Check Fail */
    CTC_FIELD_KEY_GARP,                         /**< [D2.TM.TMM.AT][BA.IF] Gratuitous ARP */
    CTC_FIELD_KEY_SENDER_MAC,                   /**< [D2.TM.TMM.AT][BA.BI] Ethernet Address of sender of ARP Header */
    CTC_FIELD_KEY_TARGET_MAC,                   /**< [D2.TM.TMM.AT][BA.BI] Ethernet Address of destination of ARP Header */
    CTC_FIELD_KEY_RARP,                         /**< [TM.TMM.AT][IS.BA] If set and layer3 type is ARP, indicate packet is RARP packet */
    CTC_FIELD_KEY_ARP_HARDWARE_TYPE,            /**< [TMM.AT][IA] ARP hardware type*/
    CTC_FIELD_KEY_ARP_PROTOCOL_ADDLEN,          /**< [TMM.AT][IA] ARP protocol addr len*/
    CTC_FIELD_KEY_ARP_HARDWARE_ADDLEN,          /**< [TMM.AT][IA] ARP hardware addr len*/
    CTC_FIELD_KEY_IS_ARP_PKT,                   /**< [TMM.AT][IF] Is ARP packet */

    /*TCP/UDP packet field*/
    CTC_FIELD_KEY_L4_DST_PORT,              /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IU.IF.BD.BI] Layer 4 Dest Port. */
    CTC_FIELD_KEY_L4_SRC_PORT,              /**< [D2.TM.TMM.TMA.AT][IS.IH.BA.IU.IF.BD.BI] Layer 4 Src Port. */
    CTC_FIELD_KEY_L4_SRC_PORT_RANGE,        /**< [D2.TM.TMM.TMA.AT][BA] Layer 4 Src Port Range; data: min, mask: max. */
    CTC_FIELD_KEY_L4_DST_PORT_RANGE,        /**< [D2.TM.TMM.TMA.AT][BA] Layer 4 Dest Port Range; data: min, mask: max. */
    CTC_FIELD_KEY_TCP_ECN,                  /**< [D2.TM.TMM.AT][IS.BA.IF.BI] TCP Ecn. */
    CTC_FIELD_KEY_TCP_FLAGS,                /**< [D2.TM.TMM.TMA.AT][IS.BA.IF.BI] TCP Flags (ctc_acl_tcp_flag_flag_t). */
    CTC_FIELD_KEY_TCP_OPTIONS,              /**< [D2.TM.TMM.AT][IU] Ip Options,used to classify UDF key */

    /*GRE packet field*/
    CTC_FIELD_KEY_GRE_KEY,                  /**< [D2.TM.TMM.AT][IS.IH.BA.IF.BI] Gre Key. */
    CTC_FIELD_KEY_GRE_FLAGS,                /**< [D2.TM.TMM.AT][BA.IU] Gre Flag,used to classify UDF key  */
    CTC_FIELD_KEY_GRE_PROTOCOL_TYPE,        /**< [D2.TM.TMM.AT][BA.IU] Gre PROTOCOL_TYPE,used to classify UDF key y*/

    /*NVGRE packet field*/
    CTC_FIELD_KEY_NVGRE_KEY,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] NVGre Key. */

    /*VXLAN packet field*/
    CTC_FIELD_KEY_VN_ID,                    /**< [D2.TM.TMM.AT][IS.IH.BA.IF] Vxlan Network Id. */
    CTC_FIELD_KEY_VXLAN_FLAGS,              /**< [TM.TMM.AT][BA] Vxlan flags: data */
    CTC_FIELD_KEY_VXLAN_RSV1,               /**< [TM.TMM.AT][BA] Vxlan packet reserved1 after flags(24 bits), data: vxlan reserved1 */
    CTC_FIELD_KEY_VXLAN_RSV2,               /**< [TM.TMM.AT][BA] Vxlan packet reserved2 after vni(8 bits), data: vxlan reserved2 */

    /*ICMP packet field*/
    CTC_FIELD_KEY_ICMP_CODE,                /**< [D2.TM.TMM.TMA.AT][IS.BA.IF.BI] ICMP Code.*/
    CTC_FIELD_KEY_ICMP_TYPE,                /**< [D2.TM.TMM.TMA.AT][IS.BA.IF.BI] ICMP Type.*/

    /*IGMP packet field*/
    CTC_FIELD_KEY_IGMP_TYPE,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] IGMP Type.*/

    /*MPLS packet field*/
    CTC_FIELD_KEY_LABEL_NUM,                /**< [D2.TM.TMM.AT][IS.BA.IU.IF.BI] MPLS Label Number. */
    CTC_FIELD_KEY_MPLS_LABEL0,              /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Label Field of the MPLS Label 0. */
    CTC_FIELD_KEY_MPLS_EXP0,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Exp Field of the MPLS Label 0.*/
    CTC_FIELD_KEY_MPLS_SBIT0,               /**< [D2.TM.TMM.AT][IS.BA.IF.BI] S-bit Field of the MPLS Label 0.*/
    CTC_FIELD_KEY_MPLS_TTL0,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Ttl Field of the MPLS Label 0.*/
    CTC_FIELD_KEY_MPLS_LABEL1,              /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Label Field of the MPLS Label 1. */
    CTC_FIELD_KEY_MPLS_EXP1,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Exp Field of the MPLS Label 1.*/
    CTC_FIELD_KEY_MPLS_SBIT1,               /**< [D2.TM.TMM.AT][IS.BA.IF.BI] S-bit Field of the MPLS Label 1.*/
    CTC_FIELD_KEY_MPLS_TTL1,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Ttl Field of the MPLS Label 1.*/
    CTC_FIELD_KEY_MPLS_LABEL2,              /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Label Field of the MPLS Label 2. */
    CTC_FIELD_KEY_MPLS_EXP2,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Exp Field of the MPLS Label 2.*/
    CTC_FIELD_KEY_MPLS_SBIT2,               /**< [D2.TM.TMM.AT][IS.BA.IF.BI] S-bit Field of the MPLS Label 2.*/
    CTC_FIELD_KEY_MPLS_TTL2,                /**< [D2.TM.TMM.AT][IS.BA.IF.BI] Ttl Field of the MPLS Label 2.*/
    CTC_FIELD_KEY_MPLS_LABEL3,              /**< [TMM.AT][BA] MPLS Label 3, format: label 20 bits, exp 3 bits, s-bit 1 bit, ttl 8 bits.*/
    CTC_FIELD_KEY_MPLS_LABEL4,              /**< [TMM.AT][BA] MPLS Label 4, format: label 20 bits, exp 3 bits, s-bit 1 bit, ttl 8 bits.*/
    CTC_FIELD_KEY_MPLS_LABEL5,              /**< [TMM.AT][BA] MPLS Label 5, format: label 20 bits, exp 3 bits, s-bit 1 bit, ttl 8 bits.*/
    CTC_FIELD_KEY_MPLS_LABEL6,              /**< [TMM.AT][BA] MPLS Label 6, format: label 20 bits, exp 3 bits, s-bit 1 bit, ttl 8 bits.*/
    CTC_FIELD_KEY_MPLS_LABEL7,              /**< [TMM.AT][BA] MPLS Label 7, format: label 20 bits, exp 3 bits, s-bit 1 bit, ttl 8 bits.*/
    CTC_FIELD_KEY_INTERFACE_ID,             /**< [D2.TM.TMM.AT][BA] L3 Interface Id,used to interface space */
    CTC_FIELD_KEY_RAL_EXIST,                /**< [TMM.AT][IA] Route alert label exist*/
    CTC_FIELD_KEY_GAL_EXIST,                /**< [TMM.AT][IA] Generic associated channel label exist*/
    CTC_FIELD_KEY_CW_EXIST,                 /**< [TMM.AT][IA.IU] Control word exist*/
    CTC_FIELD_KEY_IP_OVER_MPLS,             /**< [TMM.AT][IU] IPv4 Packet Over MPLS, only valid for UDF key.*/
    CTC_FIELD_KEY_IPV6_OVER_MPLS,           /**< [TMM.AT][IU] IPV6 Packet Over MPLS, only valid for UDF key.*/
    CTC_FIELD_KEY_MPLS_CW,                  /**< [TMM.AT][IA] Mpls Control Word */
    CTC_FIELD_KEY_MPLS_FWD_LABEL,           /**< [TMM.AT][IA] Label Field of the Mpls Forward Label */
    CTC_FIELD_KEY_MPLS_FWD_EXP,             /**< [TMM.AT][IA] Exp Field of the Mpls Forward Label */
    CTC_FIELD_KEY_MPLS_FWD_SBIT,            /**< [TMM.AT][IA] S-bit Field of the Mpls Forward Label */
    CTC_FIELD_KEY_MPLS_FWD_TTL,             /**< [TMM.AT][IA] Ttl Field of the Mpls Forward Label */
    CTC_FIELD_KEY_NPM_IM_FLOW_ID,           /**< [TMM.AT][IA] NPM In-Band Measurement Flow Id */
    CTC_FIELD_KEY_NPM_IM_L_FLAG,            /**< [TMM.AT][IA] NPM In-Band Measurement Loss Flag */
    CTC_FIELD_KEY_NPM_IM_D_FLAG,            /**< [TMM.AT][IA] NPM In-Band Measurement Delay Flag */

    /*Network Service Header (NSH)*/
    CTC_FIELD_KEY_NSH_CBIT,                 /**< [D2.TMM.AT][IA] C-bit of the Network Service Header. */
    CTC_FIELD_KEY_NSH_OBIT,                 /**< [D2.TMM.AT][BA] O-bit of the Network Service Header. */
    CTC_FIELD_KEY_NSH_NEXT_PROTOCOL,        /**< [D2.TMM.AT][BA] Next Protocol of the Network Service Header. */
    CTC_FIELD_KEY_NSH_SI,                   /**< [D2.TMM.AT][BA.IF] Service Index of the Network Service Header. */
    CTC_FIELD_KEY_NSH_SPI,                  /**< [D2.TMM.AT][BA.IF] Service Path ID of the Network Service Header. */
    CTC_FIELD_KEY_NSH_TERMINAL,             /**< [AT][IA] NSH Terminal */

    /*Ether OAM packet field*/
    CTC_FIELD_KEY_IS_Y1731_OAM,             /**< [D2.TM.TMM.AT][IS.IA] Is Y1731 Oam. */
    CTC_FIELD_KEY_ETHER_OAM_LEVEL,          /**< [D2.TM.TMM.AT][IS.BA] Oam Level. */
    CTC_FIELD_KEY_ETHER_OAM_OP_CODE,        /**< [D2.TM.TMM.AT][IS.BA] Oam Opcode. */
    CTC_FIELD_KEY_ETHER_OAM_VERSION,        /**< [D2.TM.TMM.AT][IS.BA] Oam Version. */

    /*Slow Protocol packet field*/
    CTC_FIELD_KEY_SLOW_PROTOCOL_CODE,       /**< [D2.TM.TMM.AT][IS.BA] Slow Protocol Code. */
    CTC_FIELD_KEY_SLOW_PROTOCOL_FLAGS,      /**< [D2.TM.TMM.AT][IS.BA] Slow Protocol Flags. */
    CTC_FIELD_KEY_SLOW_PROTOCOL_SUB_TYPE,   /**< [D2.TM.TMM.AT][IS.BA] Slow Protocol Sub Type. */

    /*PTP packet field*/
    CTC_FIELD_KEY_PTP_MESSAGE_TYPE,         /**< [D2.TM.TMM.AT][IS.BA] PTP Message Type. */
    CTC_FIELD_KEY_PTP_VERSION,              /**< [D2.TM.TMM.AT][IS.BA] PTP Message Version. */

    /*FCoE packet field*/
    CTC_FIELD_KEY_FCOE_DST_FCID,            /**< [D2.TM.TMM.AT][IS.BA] FCoE Destination FCID.*/
    CTC_FIELD_KEY_FCOE_SRC_FCID,            /**< [D2.TM.TMM.AT][IS.BA] FCoE Source FCID.*/

    /*Wlan packet field*/
    CTC_FIELD_KEY_WLAN_RADIO_MAC,           /**< [D2.TM][IH.BA.BI] Wlan Radio Mac.*/
    CTC_FIELD_KEY_WLAN_RADIO_ID,            /**< [D2.TM][IH.BA.BI] Wlan Radio Id.*/
    CTC_FIELD_KEY_WLAN_CTL_PKT,             /**< [D2.TM][IH.BA.BI] Wlan Control Packet.*/

    /*SATPDU packet field*/
    CTC_FIELD_KEY_SATPDU_MEF_OUI,           /**< [D2.TM.TMM.AT][BA] Satpdu Metro Ethernet Forum Oui.*/
    CTC_FIELD_KEY_SATPDU_OUI_SUB_TYPE,      /**< [D2.TM.TMM.AT][BA] Satpdu Oui Sub type.*/
    CTC_FIELD_KEY_SATPDU_PDU_BYTE,          /**< [D2.TM.TMM.AT][BA] Satpdu Byte. ext_data: uint8 value[8], refer to network byte order*/

    /*TRILL packet field*/
    CTC_FIELD_KEY_INGRESS_NICKNAME,         /**< [D2.TM.TMM.AT][IS.IH.BA] Ingress Nick Name. */
    CTC_FIELD_KEY_EGRESS_NICKNAME,          /**< [D2.TM.TMM.AT][IS.IH.BA] Egress Nick Name. */
    CTC_FIELD_KEY_IS_ESADI,                 /**< [D2.TM.TMM.AT][IS.BA] Is Esadi. */
    CTC_FIELD_KEY_IS_TRILL_CHANNEL,         /**< [D2.TM.TMM.AT][IS.BA] Is Trill Channel. */
    CTC_FIELD_KEY_TRILL_INNER_VLANID,       /**< [D2.TM.TMM.AT][IS.BA] Trill Inner Vlan Id. */
    CTC_FIELD_KEY_TRILL_INNER_VLANID_VALID, /**< [D2.TM.TMM.AT][IS.BA] Trill Inner Vlan Id Valid. */
    CTC_FIELD_KEY_TRILL_KEY_TYPE,           /**< [D2.TM.TMM.AT][IS.BA] Trill Key Type. */
    CTC_FIELD_KEY_TRILL_LENGTH,             /**< [D2.TM.TMM.AT][IS.BA] Trill Length. */
    CTC_FIELD_KEY_TRILL_MULTIHOP,           /**< [D2.TM.TMM.AT][IS.BA] Trill Multi-Hop. */
    CTC_FIELD_KEY_TRILL_MULTICAST,          /**< [D2.TM.TMM.AT][IS.BA] Trill MultiCast. */
    CTC_FIELD_KEY_TRILL_VERSION,            /**< [D2.TM.TMM.AT][IS.BA] Trill Version. */
    CTC_FIELD_KEY_TRILL_TTL,                /**< [D2.TM.TMM.AT][IS.BA] Trill Ttl. */

    /*802.1AE packet field*/
    CTC_FIELD_KEY_DOT1AE_UNKNOW_PKT,        /**< [D2.TM][IA] Unknow 802.1AE packet, SecTag error or Mode not support. */
    CTC_FIELD_KEY_DOT1AE_ES,                /**< [D2.TM][IA] End Station (ES) bit. */
    CTC_FIELD_KEY_DOT1AE_SC,                /**< [D2.TM][IA] Secure Channel (SC) bit. */
    CTC_FIELD_KEY_DOT1AE_AN,                /**< [D2.TM][IA] Association Number (AN). */
    CTC_FIELD_KEY_DOT1AE_SL,                /**< [D2.TM][IA] Short Length (SL). */
    CTC_FIELD_KEY_DOT1AE_PN,                /**< [D2.TM][IA] Packet Number. */
    CTC_FIELD_KEY_DOT1AE_SCI,               /**< [D2.TM][IA.ID] Secure Channel Identifier. ext_data: uint8 value[8], refer to network byte order*/
    CTC_FIELD_KEY_DOT1AE_CBIT,              /**< [TM][IA] Determination of whether confidentiality or integrity alone are in use, data: set use 1 and reset use 0 */
    CTC_FIELD_KEY_DOT1AE_EBIT,              /**< [TM][IA] Encryption protected, data: set use 1 and reset use 0 */
    CTC_FIELD_KEY_DOT1AE_SCB,               /**< [TM][IA] EPON Single Copy Broadcast capability, data: set use 1 and reset use 0 */
    CTC_FIELD_KEY_DOT1AE_VER,               /**< [TM][IA] Version number, data: set use 1 and reset use 0 */
    CTC_FIELD_KEY_DOT1AE_SPI,               /**< [AT][BD] Security index*/

    /*INT*/
    CTC_FIELD_KEY_INT_TYPE,                 /**< [TMM.AT][IA] INT type, data: refer to ctc_parser_int_type_t */
    CTC_FIELD_KEY_INT_LEN,                  /**< [TMM.AT][IA] INT length, IFA1.0 not support */
    CTC_FIELD_KEY_INT_VER,                  /**< [TMM.AT][IA] INT version */
    CTC_FIELD_KEY_INT_EBIT,                 /**< [TMM.AT][IA] INT E bit, exceed max hop cnt, IFA1.0 not support */
    CTC_FIELD_KEY_INT_MBIT,                 /**< [TMM.AT][IA] INT M bit, INT length exceed MTU, IFA1.0 not support */
    CTC_FIELD_KEY_INT_HOP_ML,               /**< [TMM.AT][IA] INT per hop metadadta length */
    CTC_FIELD_KEY_INT_REMAIN_HOP_CNT,       /**< [TMM.AT][IA] INT remaining hop count */
    CTC_FIELD_KEY_INT_INSTRUCTION,          /**< [TMM.AT][IA] INT instruction bitmap */

    /*UDF, user defined field*/
    CTC_FIELD_KEY_UDF,                      /**< [D2.TM.TMM.TMA.AT][IS.IH.IA] UDF; ext_data: ctc_acl_udf_t */
    CTC_FIELD_KEY_SUDF,                      /**< [TMM.AT][IA] SUDF; ext_data: ctc_acl_udf_t */
    CTC_FIELD_KEY_UDF_RANGE,                /**< [TMM.AT][IA] UDF; ext_data: ctc_acl_udf_t */
    CTC_FIELD_KEY_UDF_AD_ID,                /**< [D2.TM.TMM.AT][IS.IH.IA] UDF; ext_data: ctc_acl_udf_t */
    CTC_FIELD_KEY_SUDF_AD_ID,                /**< [TMM.AT][IA] SUDF; ext_data: ctc_acl_udf_t */

    /*Match port type*/
    CTC_FIELD_KEY_PORT,                     /**< [D2.TM.TMM.TMA.AT][IS.BH.BA.IU.IF.BD] Port; ext_data: refer to ctc_field_port_t */
    CTC_FIELD_KEY_PORT_BITMAP,              /**< [TMM.AT][BA] Port bitmap >*/
    CTC_FIELD_KEY_LPORT,                    /**< [TMM.AT][IA] Local phy port*/
    CTC_FIELD_KEY_CLASS_ID,                 /**< [D2.TM.TMM.AT][BA] Class ID*/
    CTC_FIELD_KEY_LOGIC_SRC_PORT,           /**< [TMM.AT][IA.EH] Logic source port*/
    CTC_FIELD_KEY_LOGIC_DST_PORT,           /**< [TMM.AT][IA.EH] Logic dest port*/
    CTC_FIELD_KEY_SRC_GPORT,                /**< [TMM.AT][EA.EI] Global source port in egress */

    /*Forwarding information*/
    CTC_FIELD_KEY_DECAP,                    /**< [D2.TM.TMM.AT][BA.IP] Decapsulation occurred. */
    CTC_FIELD_KEY_ENCAP,                    /**< Encryp occurred. */
    CTC_FIELD_KEY_ELEPHANT_PKT,             /**< [D2.TM.TMM.AT][IA] Is Elephant. */
    CTC_FIELD_KEY_VXLAN_PKT,                /**< [D2.TM.TMM.AT][IS.IF.BA] Is Vxlan Packet. */
    CTC_FIELD_KEY_ROUTED_PKT,               /**< [D2.TM.TMM.AT][BA.IP.IF] Is Routed packet. */
    CTC_FIELD_KEY_PKT_FWD_TYPE,             /**< [D2.TM.TMM.AT][IA.IP.ES] Packet Forwarding Type. Refer to ctc_acl_pkt_fwd_type_t */
    CTC_FIELD_KEY_MACSA_LKUP,               /**< [D2.TM.TMM.AT][IA] Mac-Sa Lookup Enable. */
    CTC_FIELD_KEY_MACSA_HIT,                /**< [D2.TM.TMM.AT][IA] Mac-Sa Lookup Hit. */
    CTC_FIELD_KEY_MACDA_LKUP,               /**< [D2.TM.TMM.AT][IA] Mac-Da Lookup Enable. */
    CTC_FIELD_KEY_MACDA_HIT,                /**< [D2.TM.TMM.AT][IA] Mac-Da Lookup Hit. */
    CTC_FIELD_KEY_IPSA_LKUP,                /**< [D2.TM.TMM.AT][IA] L3-Sa Lookup Enable. */
    CTC_FIELD_KEY_IPSA_HIT,                 /**< [D2.TM.TMM.AT][IA] L3-Sa Lookup Hit. */
    CTC_FIELD_KEY_IPDA_LKUP,                /**< [D2.TM.TMM.AT][IA] L3-Da Lookup Enable. */
    CTC_FIELD_KEY_IPDA_HIT,                 /**< [D2.TM.TMM.AT][IA] L3-Da Lookup Hit. */
    CTC_FIELD_KEY_L2_STATION_MOVE,          /**< [D2.TM.TMM.AT][IA] L2 Station Move. */
    CTC_FIELD_KEY_MAC_SECURITY_DISCARD,     /**< [D2.TM.TMM.AT][IA] Mac Security Discard only for Black Hole MAC. */

    CTC_FIELD_KEY_DST_CID,                  /**< [D2.TM.TMM.AT][BA.ES.BI] Destination Category ID. */
    CTC_FIELD_KEY_SRC_CID,                  /**< [D2.TM.TMM.AT][BA.EH.BI] Source Category ID. */
    CTC_FIELD_KEY_PORT_CID,                 /**< [TMM.AT][IA.IP] Port Category ID*/
    CTC_FIELD_KEY_VLAN_CID,                 /**< [TMM.AT][IA.IP] Vlan Category ID*/
    CTC_FIELD_KEY_L3IF_CID,                 /**< [TMM.AT][IA.IP] L3 interface Category ID*/
    CTC_FIELD_KEY_SCL_CID,                  /**< [TMM.AT][IA.IP] Scl Category ID*/
    CTC_FIELD_KEY_TUNNEL_CID,               /**< [TMM.AT][IA.IP] IP Tunnel Category ID*/
    CTC_FIELD_KEY_FLOW_CID,                 /**< [TMM.AT][IA.IP] Flow acl Category ID*/
    CTC_FIELD_KEY_FID_CID,                  /**< [TMM.AT][IA.IP] VSI Category ID*/
    CTC_FIELD_KEY_NEXTHOP_CID,              /**< [TMM.AT][EA] Nexthop Category ID*/

    CTC_FIELD_KEY_DISCARD,                  /**< [D2.TM.TMM.AT][BA.IP] Packet Is Flagged to be Discarded.
                                                                    Two mode: 1 only match discard by key.data;
                                                                              2 match detail discard type or drop reason by (uint32*) key.ext_data,
                                                                                the discard type refer to IPEDISCARDTYPE_XXX defined in sys_usw_register.c and
                                                                                the drop reason refer to ctc_drop_reason_t */
    CTC_FIELD_KEY_CPU_REASON_ID,            /**< [D2.TM.TMM.AT][BA] CPU Reason Id, if ext_data != 0, data is recognized as acl_match_grp_id.. */
    CTC_FIELD_KEY_DST_GPORT,                /**< [D2.TM.TMM.AT][EH.IA] Fwd Destination Port. */
    CTC_FIELD_KEY_DST_NHID,                 /**< [D2.TM.TMM.AT][BA] Nexthop Id. If ext_data != 0 and data/mask == 0, *(uint32*)key.ext_data is recognized as dsnexthop offset*/

    CTC_FIELD_KEY_MCAST_RPF_CHECK_FAIL,     /**< [D2.TMM.AT][IA] Mcast Rpf Check Fail. */

    CTC_FIELD_KEY_VRFID,                    /**< [D2.TM.TMM.AT][IF.BA.BI] Vrfid. */
    CTC_FIELD_KEY_METADATA,                 /**< [D2.TM.TMM.AT][EH.BA.IU.IF] Metadata. */
    CTC_FIELD_KEY_CUSTOMER_ID,              /**< [D2.TM.TMM.AT][IS.IH] Customer Id*/
    CTC_FIELD_KEY_IS_LOG_PKT,               /**< [D2.TM.TMM.AT][IA.IP] Log to Cpu Packet. */

    CTC_FIELD_KEY_PRIORITY,                /**< [TMM.AT][BA] Priority*/
    CTC_FIELD_KEY_COLOR,                   /**< [TMM.AT][IA] Color*/
    CTC_FIELD_KEY_FID,                     /**< [TMM.AT][EH.BA.BI] Fid */
    CTC_FIELD_KEY_MIRROR_PKT,              /**< [TMM.AT][BA] Mirror Packet */
    CTC_FIELD_KEY_ISOLATION_ID,            /**< [TMM.AT][EH] Isolation ID, used for scl */
    CTC_FIELD_KEY_LP_GRP,                  /**< [TMM.AT][EH] Logic port group ID, used for scl*/
    CTC_FIELD_KEY_INNER_HEAD,              /**< [TMM.AT][IA] ACL match inner pkt info */
    CTC_FIELD_KEY_IS_MY_SID,               /**< [TMM.AT][IA] SRv6 is matched My SID Table */
    CTC_FIELD_KEY_SNIFFING_PKT,            /**< [AT][BA] Sniffing packet */
    CTC_FIELD_KEY_MARK_ECN,                /**< [AT][EA] Marked ECN */
    CTC_FIELD_KEY_CONGEST_EVENT,           /**< [AT][EA] Congestion event */
    CTC_FIELD_KEY_BURST_EVENT,             /**< [AT][EA] Burst event */
    CTC_FIELD_KEY_NAT_IFTYPE,              /**< [AT][IA] the type of NAT, data: 0- external,1- internal */
    CTC_FIELD_KEY_LDP_CID,                 /**< [AT][EA] Logic dest port category id */
    CTC_FIELD_KEY_APS_PROTECT1_EN,         /**< [AT][IA] Aps protection1 enable */

    /*Merge Key */
    CTC_FIELD_KEY_AWARE_TUNNEL_INFO,        /**< [D2.TM.TMM.AT][BA.BI] Aware Tunnel Info. ext_data: refer to ctc_acl_tunnel_data_t.*/

    /*HASH key field*/
    CTC_FIELD_KEY_HASH_VALID,               /**< [D2.TM.TMM.TMA.AT][BH] Hash Valid Key. */

    CTC_FIELD_KEY_IS_ROUTER_MAC,            /**< [D2.TM.TMM.AT][IF] MacDa is Router Mac. */
    CTC_FIELD_KEY_INNER_IS_RTMAC,      /**< [AT][IA] Inner MacDa is Router Mac. */
    CTC_FIELD_KEY_HASH_SEL_ID,              /**< [D2.TM.TMM.AT] delete */

    /*Stacking Header*/
    CTC_FIELD_KEY_STK_HDR_EXIST,            /**< [TMM.AT][BA] Stacking Header exist: data, ext_data: bit0-bit4 for exact header exist,
                                                              bit0- LearningHeader, bit1- CidHeader, bit2- EgreditHeader, bit3- OamHeader, bit4- XDataHeader  */
    CTC_FIELD_KEY_STK_LKUP,                 /**< [TMM.AT][IA] Stacking lookup enable */
    CTC_FIELD_KEY_STK_DST_GPORT,            /**< [TMM.AT][IA] Dest port in stacking header */
    CTC_FIELD_KEY_STK_SRC_GPORT,            /**< [TMM.AT][IA] Source port in stacking header */
    CTC_FIELD_KEY_STK_FID,                  /**< [TMM.AT][IA] Learning fid in stacking header */
    CTC_FIELD_KEY_STK_LOGIC_SRC_PORT,       /**< [TMM.AT][IA] Logic src port in stacking header */
    CTC_FIELD_KEY_STK_PRIORITY,             /**< [TMM.AT][IA] Priority in stacking header */
    CTC_FIELD_KEY_STK_SRC_CID,              /**< [TMM.AT][IA] Source cid in stacking header */
    CTC_FIELD_KEY_STK_MIRROR_PKT,           /**< [TMM.AT][IA] Mirror packet in stacking header */
    CTC_FIELD_KEY_TO_STK,                   /**< [AT][EA] Packet being forward to stacking port */

    /*Other*/
    CTC_FIELD_KEY_UDF_ENTRY_VALID,          /**< [D2.TM.TMM.TMA.AT][IU] classify udf entry Valid Key. */
    CTC_FIELD_KEY_VLAN_XLATE_HIT,           /**< [TM.TMM.AT][EA] If Vlan xlate not hit, do egress acl lookup. data: enable use 1 and disable use 0 */
    CTC_FIELD_KEY_GEM_PORT,                 /**< [TM.TMM.AT][IA] Gem port for xgpon: data */
    CTC_FIELD_KEY_PRESEL_ENTRY_VALID,       /**< [TMM.AT][IP] Presel entry Valid key */
    CTC_FIELD_KEY_SRV6_SRH_FLAG,            /**< [TMM.AT][IA] The flag of SRH when processes SRv6 */
    CTC_FIELD_KEY_SRV6_SRH_NH,              /**< [TMM.AT][IA] The Next Header Type of SRH when processes SRv6 */
    CTC_FIELD_KEY_SRV6_SRH_RT,              /**< [TMM.AT][IA] The Routing Type of SRH when processes SRv6 */
    CTC_FIELD_KEY_SRV6_SRH_SL,              /**< [TMM.AT][IA] The Segment Left of SRH when processes SRv6 */
    CTC_FIELD_KEY_SRV6_SRH_LE,              /**< [TMM.AT][IA] The Last Entry of SRH when processes SRv6 */
    CTC_FIELD_KEY_SRV6_SRH_TAG,             /**< [TMM.AT][IA] The Tag of SRH when processes SRv6 */
    CTC_FIELD_KEY_SUDF_RANGE,               /**< [TMM.AT][IA] SUDF; ext_data: ctc_acl_udf_t */
    CTC_FIELD_KEY_IPFIX_PROFILE_ID,         /**< [AT][BI] The ipfix config profile id */
    CTC_FIELD_KEY_INT_PKT,                  /**< [TMM.AT][IA] Is INT Packet. */
    CTC_FIELD_KEY_XDATA,                    /**< [AT][BH.BI] xdata */
    CTC_FIELD_KEY_L4_HDR_ERROR,             /**< [AT][IA] Packet Layer4 header check error, bit0-gre error, bit1-icmp error, bit2-TcpUdp error */
    CTC_FIELD_KEY_LEN_ERROR,                /**< [AT][BA] Packet header len check error, data: 0-any errors, bit0-bit5 for exact header length error,
                                                                    bit0- L2, bit1- L4, bit2- L4_user, bit3- L2_ext, bit4- L3_ext, bit5- L5 */
    CTC_FIELD_KEY_ROUTE_DATA,               /**< [TMM.AT][IA] Route flex data */
    CTC_FIELD_KEY_BFD_MY_DISC,                  /**< [TMM.AT][BA] BFD my discriminator */
    CTC_FIELD_KEY_BFD_YOUR_DISC,                /**< [TMM.AT][BA] BFD your discriminator */
    CTC_FIELD_KEY_NUM = 288
};
typedef enum ctc_field_key_type_e ctc_field_key_type_t;



struct ctc_field_key_s
{
    uint16 type;                    /**< [D2.TM.TMM.TMA.AT] Key Field type, ctc_field_key_type_t. */

    uint32 data;                    /**< [D2.TM.TMM.TMA.AT] Key Field data (uint32). */
    uint32 mask;                    /**< [D2.TM.TMM.TMA.AT] Key Field mask (uint32). */
    void*  ext_data;                /**< [D2.TM.TMM.TMA.AT] Key Field extend data (void*). */
    void*  ext_mask;                /**< [D2.TM.TMM.TMA.AT] Key Field extend mask (void*). */
};
typedef struct ctc_field_key_s ctc_field_key_t;


enum ctc_field_port_type_e
{
    CTC_FIELD_PORT_TYPE_NONE,         /**< [GB.GG.D2.TM.TMM.AT] don't care port type */
    CTC_FIELD_PORT_TYPE_PORT_BITMAP,  /**< [GB.GG.D2.TM.TMM.TMA.AT] valid Port bitmap */
    CTC_FIELD_PORT_TYPE_GPORT,        /**< [GG.D2.TM.TMM.AT] valid GlobalPort */
    CTC_FIELD_PORT_TYPE_LOGIC_PORT,   /**< [GB.GG.D2.TM.TMM.AT] valid logic port */
    CTC_FIELD_PORT_TYPE_PORT_CLASS,   /**< [GB.GG.D2.TM.TMM.AT] valid port class */
    CTC_FIELD_PORT_TYPE_VLAN_CLASS,   /**< [GB.GG.D2.TM.TMM.AT] valid vlan class */
    CTC_FIELD_PORT_TYPE_L3IF_CLASS,   /**< [D2.TM.TMM.AT] valid l3if class */
    CTC_FIELD_PORT_TYPE_PBR_CLASS,    /**< [GB.GG.D2.TM.TMM.AT] valid pbr class */

    CTC_FIELD_PORT_TYPE_MAX
};
typedef enum ctc_field_port_type_e ctc_field_port_type_t;

struct ctc_field_port_s
{
    uint8  type;                   /**< [GB.GG.D2.TM.TMM.TMA.AT] Refer to ctc_field_port_type_t */
    uint16 port_class_id;          /**< [GB.GG.D2.TM.TMM.AT] port class id */
    uint16 logic_port;             /**< [GB.GG.D2.TM.TMM.AT] logic port.  */
    uint32 gport;                  /**< [GG.D2.TM.TMM.AT] gport. */

    /*Only used for ACL key field  */
    uint8  lchip;                  /**< [GB.GG.D2.TM.TMM.AT] Local device id, only for type= PORT_BITMAP, Other type ignore it*/
    ctc_port_bitmap_t port_bitmap; /**< [GB.GG.D2.TM.TMM.TMA.AT] bitmap*/
    uint16 vlan_class_id;          /**< [GB.GG.D2.TM.TMM.AT] vlan class id */
    uint16 l3if_class_id;          /**< [GB.GG.D2.TM.TMM.AT] vlan class id */
    uint8  pbr_class_id;           /**< [GB.GG.D2.TM.TMM.AT] pbr class id. */
};
typedef struct ctc_field_port_s ctc_field_port_t;

/**
@brief flex hash key mode
*/
enum ctc_field_flex_key_mode_e
{
    CTC_FIELD_FLEX_KEY_MODE_NONE,           /**< [AT] none flex key mode */
    CTC_FIELD_FLEX_KEY_MODE_APPEND,         /**< [AT] append key */
    CTC_FIELD_FLEX_KEY_MODE_DOUBLE_APPEND,  /**< [AT] double and append key */
    CTC_FIELD_FLEX_KEY_MODE_REPLACE,        /**< [AT] replace key */
    CTC_FIELD_FLEX_KEY_MODE_MAX,
};
typedef enum ctc_field_flex_key_mode_e ctc_field_flex_key_mode_t;

#ifdef __cplusplus
}
#endif

#endif


